home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / binutils.252 / gas / app.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-19  |  16.5 KB  |  743 lines

  1. /* This is the Assembler Pre-Processor
  2.    Copyright (C) 1987, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
  3.  
  4.    This file is part of GAS, the GNU Assembler.
  5.  
  6.    GAS is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2, or (at your option)
  9.    any later version.
  10.  
  11.    GAS is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with GAS; see the file COPYING.  If not, write to
  18.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* Modified by Allen Wirfs-Brock, Instantiations Inc 2/90 */
  21. /* App, the assembler pre-processor.  This pre-processor strips out excess
  22.    spaces, turns single-quoted characters into a decimal constant, and turns
  23.    # <number> <filename> <garbage> into a .line <number>\n.file <filename>
  24.    pair.  This needs better error-handling.  */
  25.  
  26. #include <stdio.h>
  27. #include "as.h"            /* For BAD_CASE() only */
  28.  
  29. #if (__STDC__ != 1)
  30. #ifndef const
  31. #define const  /* empty */
  32. #endif
  33. #endif
  34.  
  35. static char lex[256];
  36. static const char symbol_chars[] =
  37. "$._ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  38.  
  39. #define LEX_IS_SYMBOL_COMPONENT        1
  40. #define LEX_IS_WHITESPACE        2
  41. #define LEX_IS_LINE_SEPARATOR        3
  42. #define LEX_IS_COMMENT_START        4
  43. #define LEX_IS_LINE_COMMENT_START    5
  44. #define    LEX_IS_TWOCHAR_COMMENT_1ST    6
  45. #define    LEX_IS_TWOCHAR_COMMENT_2ND    7
  46. #define    LEX_IS_STRINGQUOTE        8
  47. #define    LEX_IS_COLON            9
  48. #define    LEX_IS_NEWLINE            10
  49. #define    LEX_IS_ONECHAR_QUOTE        11
  50. #define IS_SYMBOL_COMPONENT(c)        (lex[c] == LEX_IS_SYMBOL_COMPONENT)
  51. #define IS_WHITESPACE(c)        (lex[c] == LEX_IS_WHITESPACE)
  52. #define IS_LINE_SEPARATOR(c)        (lex[c] == LEX_IS_LINE_SEPARATOR)
  53. #define IS_COMMENT(c)            (lex[c] == LEX_IS_COMMENT_START)
  54. #define IS_LINE_COMMENT(c)        (lex[c] == LEX_IS_LINE_COMMENT_START)
  55. #define    IS_NEWLINE(c)            (lex[c] == LEX_IS_NEWLINE)
  56.  
  57. static int process_escape PARAMS ((int));
  58.  
  59. /* FIXME-soon: The entire lexer/parser thingy should be
  60.    built statically at compile time rather than dynamically
  61.    each and every time the assembler is run.  xoxorich. */
  62.  
  63. void 
  64. do_scrub_begin ()
  65. {
  66.   const char *p;
  67.  
  68.   lex[' '] = LEX_IS_WHITESPACE;
  69.   lex['\t'] = LEX_IS_WHITESPACE;
  70.   lex['\n'] = LEX_IS_NEWLINE;
  71.   lex[';'] = LEX_IS_LINE_SEPARATOR;
  72.   lex['"'] = LEX_IS_STRINGQUOTE;
  73. #ifndef TC_HPPA
  74.   lex['\''] = LEX_IS_ONECHAR_QUOTE;
  75. #endif
  76.   lex[':'] = LEX_IS_COLON;
  77.  
  78.  
  79.  
  80. #ifdef SINGLE_QUOTE_STRINGS
  81.   lex['\''] = LEX_IS_STRINGQUOTE;
  82. #endif
  83.  
  84.   /* Note that these override the previous defaults, e.g. if ';' is a
  85.      comment char, then it isn't a line separator.  */
  86.   for (p = symbol_chars; *p; ++p)
  87.     {
  88.       lex[(unsigned char) *p] = LEX_IS_SYMBOL_COMPONENT;
  89.     }                /* declare symbol characters */
  90.  
  91.   for (p = comment_chars; *p; p++)
  92.     {
  93.       lex[(unsigned char) *p] = LEX_IS_COMMENT_START;
  94.     }                /* declare comment chars */
  95.  
  96.   for (p = line_comment_chars; *p; p++)
  97.     {
  98.       lex[(unsigned char) *p] = LEX_IS_LINE_COMMENT_START;
  99.     }                /* declare line comment chars */
  100.  
  101.   for (p = line_separator_chars; *p; p++)
  102.     {
  103.       lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR;
  104.     }                /* declare line separators */
  105.  
  106.   /* Only allow slash-star comments if slash is not in use */
  107.   if (lex['/'] == 0)
  108.     {
  109.       lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST;
  110.     }
  111.   /* FIXME-soon.  This is a bad hack but otherwise, we can't do
  112.      c-style comments when '/' is a line comment char. xoxorich. */
  113.   if (lex['*'] == 0)
  114.     {
  115.       lex['*'] = LEX_IS_TWOCHAR_COMMENT_2ND;
  116.     }
  117. }                /* do_scrub_begin() */
  118.  
  119. FILE *scrub_file;
  120.  
  121. int 
  122. scrub_from_file ()
  123. {
  124.   return getc (scrub_file);
  125. }
  126.  
  127. void 
  128. scrub_to_file (ch)
  129.      int ch;
  130. {
  131.   ungetc (ch, scrub_file);
  132. }                /* scrub_to_file() */
  133.  
  134. char *scrub_string;
  135. char *scrub_last_string;
  136.  
  137. int 
  138. scrub_from_string ()
  139. {
  140.   return scrub_string == scrub_last_string ? EOF : *scrub_string++;
  141. }                /* scrub_from_string() */
  142.  
  143. void 
  144. scrub_to_string (ch)
  145.      int ch;
  146. {
  147.   *--scrub_string = ch;
  148. }                /* scrub_to_string() */
  149.  
  150. /* Saved state of the scrubber */
  151. static int state;
  152. static int old_state;
  153. static char *out_string;
  154. static char out_buf[20];
  155. static int add_newlines = 0;
  156.  
  157. /* Data structure for saving the state of app across #include's.  Note that
  158.    app is called asynchronously to the parsing of the .include's, so our
  159.    state at the time .include is interpreted is completely unrelated.
  160.    That's why we have to save it all.  */
  161.  
  162. struct app_save
  163.   {
  164.     int state;
  165.     int old_state;
  166.     char *out_string;
  167.     char out_buf[sizeof (out_buf)];
  168.     int add_newlines;
  169.     char *scrub_string;
  170.     char *scrub_last_string;
  171.     FILE *scrub_file;
  172.   };
  173.  
  174. char *
  175. app_push ()
  176. {
  177.   register struct app_save *saved;
  178.  
  179.   saved = (struct app_save *) xmalloc (sizeof (*saved));
  180.   saved->state = state;
  181.   saved->old_state = old_state;
  182.   saved->out_string = out_string;
  183.   memcpy (saved->out_buf, out_buf, sizeof (out_buf));
  184.   saved->add_newlines = add_newlines;
  185.   saved->scrub_string = scrub_string;
  186.   saved->scrub_last_string = scrub_last_string;
  187.   saved->scrub_file = scrub_file;
  188.  
  189.   /* do_scrub_begin() is not useful, just wastes time. */
  190.   return (char *) saved;
  191. }
  192.  
  193. void 
  194. app_pop (arg)
  195.      char *arg;
  196. {
  197.   register struct app_save *saved = (struct app_save *) arg;
  198.  
  199.   /* There is no do_scrub_end (). */
  200.   state = saved->state;
  201.   old_state = saved->old_state;
  202.   out_string = saved->out_string;
  203.   memcpy (out_buf, saved->out_buf, sizeof (out_buf));
  204.   add_newlines = saved->add_newlines;
  205.   scrub_string = saved->scrub_string;
  206.   scrub_last_string = saved->scrub_last_string;
  207.   scrub_file = saved->scrub_file;
  208.  
  209.   free (arg);
  210. }                /* app_pop() */
  211.  
  212. /* @@ This assumes that \n &c are the same on host and target.  This is not
  213.    necessarily true.  */
  214. static int 
  215. process_escape (ch)
  216.      int ch;
  217. {
  218.   switch (ch)
  219.     {
  220.     case 'b':
  221.       return '\b';
  222.     case 'f':
  223.       return '\f';
  224.     case 'n':
  225.       return '\n';
  226.     case 'r':
  227.       return '\r';
  228.     case 't':
  229.       return '\t';
  230.     case '\'':
  231.       return '\'';
  232.     case '"':
  233.       return '\"';
  234.     default:
  235.       return ch;
  236.     }
  237. }
  238. int 
  239. do_scrub_next_char (get, unget)
  240.      int (*get) ();
  241.      void (*unget) ();
  242. {
  243.   /*State 0: beginning of normal line
  244.       1: After first whitespace on line (flush more white)
  245.       2: After first non-white (opcode) on line (keep 1white)
  246.       3: after second white on line (into operands) (flush white)
  247.       4: after putting out a .line, put out digits
  248.       5: parsing a string, then go to old-state
  249.       6: putting out \ escape in a "d string.
  250.       7: After putting out a .appfile, put out string.
  251.       8: After putting out a .appfile string, flush until newline.
  252.       9: After seeing symbol char in state 3 (keep 1white after symchar)
  253.      10: After seeing whitespace in state 9 (keep white before symchar)
  254.      11: After seeing a symbol character in state 0 (eg a label definition)
  255.      -1: output string in out_string and go to the state in old_state
  256.      -2: flush text until a '*' '/' is seen, then go to state old_state
  257.       */
  258.  
  259.   /* I added states 9 and 10 because the MIPS ECOFF assembler uses
  260.      constructs like ``.loc 1 20''.  This was turning into ``.loc
  261.      120''.  States 9 and 10 ensure that a space is never dropped in
  262.      between characters which could appear in a identifier.  Ian
  263.      Taylor, ian@cygnus.com.
  264.  
  265.      I added state 11 so that something like "Lfoo add %r25,%r26,%r27" works
  266.      correctly on the PA (and any other target where colons are optional).
  267.      Jeff Law, law@cs.utah.edu.  */
  268.  
  269.   register int ch, ch2 = 0;
  270.   int not_cpp_line = 0;
  271.  
  272.   switch (state)
  273.     {
  274.     case -1:
  275.       ch = *out_string++;
  276.       if (*out_string == 0)
  277.     {
  278.       state = old_state;
  279.       old_state = 3;
  280.     }
  281.       return ch;
  282.  
  283.     case -2:
  284.       for (;;)
  285.     {
  286.       do
  287.         {
  288.           ch = (*get) ();
  289.         }
  290.       while (ch != EOF && ch != '\n' && ch != '*');
  291.       if (ch == '\n' || ch == EOF)
  292.         return ch;
  293.  
  294.       /* At this point, ch must be a '*' */
  295.       while ((ch = (*get) ()) == '*')
  296.         {
  297.           ;
  298.         }
  299.       if (ch == EOF || ch == '/')
  300.         break;
  301.       (*unget) (ch);
  302.     }
  303.       state = old_state;
  304.       return ' ';
  305.  
  306.     case 4:
  307.       ch = (*get) ();
  308.       if (ch == EOF || (ch >= '0' && ch <= '9'))
  309.     return ch;
  310.       else
  311.     {
  312.       while (ch != EOF && IS_WHITESPACE (ch))
  313.         ch = (*get) ();
  314.       if (ch == '"')
  315.         {
  316.           (*unget) (ch);
  317.           out_string = "\n\t.appfile ";
  318.           old_state = 7;
  319.           state = -1;
  320.           return *out_string++;
  321.         }
  322.       else
  323.         {
  324.           while (ch != EOF && ch != '\n')
  325.         ch = (*get) ();
  326.           state = 0;
  327.           return ch;
  328.         }
  329.     }
  330.  
  331.     case 5:
  332.       ch = (*get) ();
  333.       if (lex[ch] == LEX_IS_STRINGQUOTE)
  334.     {
  335.       state = old_state;
  336.       return ch;
  337.     }
  338. #ifndef NO_STRING_ESCAPES
  339.       else if (ch == '\\')
  340.     {
  341.       state = 6;
  342.       return ch;
  343.     }
  344. #endif
  345.       else if (ch == EOF)
  346.     {
  347.       as_warn ("End of file in string: inserted '\"'");
  348.       state = old_state;
  349.       (*unget) ('\n');
  350.       return '"';
  351.     }
  352.       else
  353.     {
  354.       return ch;
  355.     }
  356.  
  357.     case 6:
  358.       state = 5;
  359.       ch = (*get) ();
  360.       switch (ch)
  361.     {
  362.       /* Handle strings broken across lines, by turning '\n' into
  363.          '\\' and 'n'.  */
  364.     case '\n':
  365.       (*unget) ('n');
  366.       add_newlines++;
  367.       return '\\';
  368.  
  369.     case '"':
  370.     case '\\':
  371.     case 'b':
  372.     case 'f':
  373.     case 'n':
  374.     case 'r':
  375.     case 't':
  376. #ifdef BACKSLASH_V
  377.     case 'v':
  378. #endif /* BACKSLASH_V */
  379.     case 'x':
  380.     case 'X':
  381.     case '0':
  382.     case '1':
  383.     case '2':
  384.     case '3':
  385.     case '4':
  386.     case '5':
  387.     case '6':
  388.     case '7':
  389.       break;
  390. #if defined(IGNORE_NONSTANDARD_ESCAPES) | defined(ONLY_STANDARD_ESCAPES)
  391.     default:
  392.       as_warn ("Unknown escape '\\%c' in string: Ignored", ch);
  393.       break;
  394. #else /* ONLY_STANDARD_ESCAPES */
  395.     default:
  396.       /* Accept \x as x for any x */
  397.       break;
  398. #endif /* ONLY_STANDARD_ESCAPES */
  399.  
  400.     case EOF:
  401.       as_warn ("End of file in string: '\"' inserted");
  402.       return '"';
  403.     }
  404.       return ch;
  405.  
  406.     case 7:
  407.       ch = (*get) ();
  408.       state = 5;
  409.       old_state = 8;
  410.       return ch;
  411.  
  412.     case 8:
  413.       do
  414.     ch = (*get) ();
  415.       while (ch != '\n');
  416.       state = 0;
  417.       return ch;
  418.     }
  419.  
  420.   /* OK, we are somewhere in states 0 through 4 or 9 through 11 */
  421.  
  422.   /* flushchar: */
  423.   ch = (*get) ();
  424. recycle:
  425.   if (ch == EOF)
  426.     {
  427.       if (state != 0)
  428.     as_warn ("End of file not at end of a line: Newline inserted.");
  429.       return ch;
  430.     }
  431.  
  432.   switch (lex[ch])
  433.     {
  434.     case LEX_IS_WHITESPACE:
  435.       do
  436.     /* Preserve a single whitespace character at the beginning of
  437.        a line.  */
  438.     if (state == 0)
  439.       {
  440.         state = 1;
  441.         return ch;
  442.       }
  443.     else
  444.       ch = (*get) ();
  445.       while (ch != EOF && IS_WHITESPACE (ch));
  446.       if (ch == EOF)
  447.     return ch;
  448.  
  449.       if (IS_COMMENT (ch)
  450.       || (state == 0 && IS_LINE_COMMENT (ch))
  451.       || ch == '/'
  452.       || IS_LINE_SEPARATOR (ch))
  453.     {
  454.       /* cpp never outputs a leading space before the #, so try to
  455.          avoid being confused.  */
  456.       not_cpp_line = 1;
  457.       goto recycle;
  458.     }
  459. #ifdef MRI
  460.       (*unget) (ch);        /* Put back */
  461.       return ' ';        /* Always return one space at start of line */
  462. #endif
  463.  
  464.       /* If we're in state 2 or 11, we've seen a non-white character
  465.      followed by whitespace.  If the next character is ':', this
  466.      is whitespace after a label name which we *must* ignore.  */
  467.       if ((state == 2 || state == 11) && lex[ch] == LEX_IS_COLON)
  468.     {
  469.       state = 1;
  470.       return ch;
  471.     }
  472.  
  473.       switch (state)
  474.     {
  475.     case 0:
  476.       state++;
  477.       goto recycle;        /* Punted leading sp */
  478.     case 1:
  479.       /* We can arrive here if we leave a leading whitespace character
  480.          at the beginning of a line.  */
  481.       goto recycle;
  482.     case 2:
  483.       state = 3;
  484.       (*unget) (ch);
  485.       return ' ';        /* Sp after opco */
  486.     case 3:
  487.       goto recycle;        /* Sp in operands */
  488.     case 9:
  489.     case 10:
  490.       state = 10;        /* Sp after symbol char */
  491.       goto recycle;
  492.     case 11:
  493.       state = 1;
  494.       (*unget) (ch);
  495.       return ' ';        /* Sp after label definition.  */
  496.     default:
  497.       BAD_CASE (state);
  498.     }
  499.       break;
  500.  
  501.     case LEX_IS_TWOCHAR_COMMENT_1ST:
  502.       ch2 = (*get) ();
  503.       if (ch2 != EOF && lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND)
  504.     {
  505.       for (;;)
  506.         {
  507.           do
  508.         {
  509.           ch2 = (*get) ();
  510.           if (ch2 != EOF && IS_NEWLINE (ch2))
  511.             add_newlines++;
  512.         }
  513.           while (ch2 != EOF &&
  514.              (lex[ch2] != LEX_IS_TWOCHAR_COMMENT_2ND));
  515.  
  516.           while (ch2 != EOF &&
  517.              (lex[ch2] == LEX_IS_TWOCHAR_COMMENT_2ND))
  518.         {
  519.           ch2 = (*get) ();
  520.         }
  521.  
  522.           if (ch2 == EOF
  523.           || lex[ch2] == LEX_IS_TWOCHAR_COMMENT_1ST)
  524.         break;
  525.           (*unget) (ch);
  526.         }
  527.       if (ch2 == EOF)
  528.         as_warn ("End of file in multiline comment");
  529.  
  530.       ch = ' ';
  531.       goto recycle;
  532.     }
  533.       else
  534.     {
  535.       if (ch2 != EOF)
  536.         (*unget) (ch2);
  537.       if (state == 9 || state == 10)
  538.         state = 3;
  539.       return ch;
  540.     }
  541.       break;
  542.  
  543.     case LEX_IS_STRINGQUOTE:
  544.       if (state == 9 || state == 10)
  545.     old_state = 3;
  546.       else
  547.     old_state = state;
  548.       state = 5;
  549.       return ch;
  550. #ifndef MRI
  551. #ifndef IEEE_STYLE
  552.     case LEX_IS_ONECHAR_QUOTE:
  553.       ch = (*get) ();
  554.       if (ch == EOF)
  555.     {
  556.       as_warn ("End-of-file after a one-character quote; \\000 inserted");
  557.       ch = 0;
  558.     }
  559.       if (ch == '\\')
  560.     {
  561.       ch = (*get) ();
  562.       ch = process_escape (ch);
  563.     }
  564.       sprintf (out_buf, "%d", (int) (unsigned char) ch);
  565.  
  566.  
  567.       /* None of these 'x constants for us.  We want 'x'.  */
  568.       if ((ch = (*get) ()) != '\'')
  569.     {
  570. #ifdef REQUIRE_CHAR_CLOSE_QUOTE
  571.       as_warn ("Missing close quote: (assumed)");
  572. #else
  573.       (*unget) (ch);
  574. #endif
  575.     }
  576.       if (strlen (out_buf) == 1)
  577.     {
  578.       return out_buf[0];
  579.     }
  580.       if (state == 9 || state == 10)
  581.     old_state = 3;
  582.       else
  583.     old_state = state;
  584.       state = -1;
  585.       out_string = out_buf;
  586.       return *out_string++;
  587. #endif
  588. #endif
  589.     case LEX_IS_COLON:
  590.       if (state == 9 || state == 10)
  591.     state = 3;
  592.       else if (state != 3)
  593.     state = 1;
  594.       return ch;
  595.  
  596.     case LEX_IS_NEWLINE:
  597.       /* Roll out a bunch of newlines from inside comments, etc.  */
  598.       if (add_newlines)
  599.     {
  600.       --add_newlines;
  601.       (*unget) (ch);
  602.     }
  603.       /* fall thru into... */
  604.  
  605.     case LEX_IS_LINE_SEPARATOR:
  606.       state = 0;
  607.       return ch;
  608.  
  609.     case LEX_IS_LINE_COMMENT_START:
  610.       if (state == 0)        /* Only comment at start of line.  */
  611.     {
  612.       /* FIXME-someday: The two character comment stuff was badly
  613.          thought out.  On i386, we want '/' as line comment start
  614.          AND we want C style comments.  hence this hack.  The
  615.          whole lexical process should be reworked.  xoxorich.  */
  616.       if (ch == '/')
  617.         {
  618.           ch2 = (*get) ();
  619.           if (ch2 == '*')
  620.         {
  621.           state = -2;
  622.           return (do_scrub_next_char (get, unget));
  623.         }
  624.           else
  625.         {
  626.           (*unget) (ch2);
  627.         }
  628.         }            /* bad hack */
  629.  
  630.       if (ch != '#')
  631.         not_cpp_line = 1;
  632.  
  633.       do
  634.         ch = (*get) ();
  635.       while (ch != EOF && IS_WHITESPACE (ch));
  636.       if (ch == EOF)
  637.         {
  638.           as_warn ("EOF in comment:  Newline inserted");
  639.           return '\n';
  640.         }
  641.       if (ch < '0' || ch > '9' || not_cpp_line)
  642.         {
  643.           /* Non-numerics:  Eat whole comment line */
  644.           while (ch != EOF && !IS_NEWLINE (ch))
  645.         ch = (*get) ();
  646.           if (ch == EOF)
  647.         as_warn ("EOF in Comment: Newline inserted");
  648.           state = 0;
  649.           return '\n';
  650.         }
  651.       /* Numerics begin comment.  Perhaps CPP `# 123 "filename"' */
  652.       (*unget) (ch);
  653.       old_state = 4;
  654.       state = -1;
  655.       out_string = "\t.appline ";
  656.       return *out_string++;
  657.     }
  658.  
  659.       /* We have a line comment character which is not at the start of
  660.      a line.  If this is also a normal comment character, fall
  661.      through.  Otherwise treat it as a default character.  */
  662.       if (strchr (comment_chars, ch) == NULL)
  663.     goto de_fault;
  664.       /* Fall through.  */
  665.     case LEX_IS_COMMENT_START:
  666.       do
  667.     ch = (*get) ();
  668.       while (ch != EOF && !IS_NEWLINE (ch));
  669.       if (ch == EOF)
  670.     as_warn ("EOF in comment:  Newline inserted");
  671.       state = 0;
  672.       return '\n';
  673.  
  674.     case LEX_IS_SYMBOL_COMPONENT:
  675.       if (state == 10)
  676.     {
  677.       /* This is a symbol character following another symbol
  678.          character, with whitespace in between.  We skipped the
  679.          whitespace earlier, so output it now.  */
  680.       (*unget) (ch);
  681.       state = 3;
  682.       return ' ';
  683.     }
  684.       if (state == 3)
  685.     state = 9;
  686.       /* Fall through.  */
  687.     default:
  688.     de_fault:
  689.       /* Some relatively `normal' character.  */
  690.       if (state == 0)
  691.     {
  692.       state = 11;        /* Now seeing label definition */
  693.       return ch;
  694.     }
  695.       else if (state == 1)
  696.     {
  697.       state = 2;        /* Ditto */
  698.       return ch;
  699.     }
  700.       else if (state == 9)
  701.     {
  702.       if (lex[ch] != LEX_IS_SYMBOL_COMPONENT)
  703.         state = 3;
  704.       return ch;
  705.     }
  706.       else if (state == 10)
  707.     {
  708.       state = 3;
  709.       return ch;
  710.     }
  711.       else
  712.     {
  713.       return ch;        /* Opcode or operands already */
  714.     }
  715.     }
  716.   return -1;
  717. }
  718.  
  719. #ifdef TEST
  720.  
  721. const char comment_chars[] = "|";
  722. const char line_comment_chars[] = "#";
  723.  
  724. main ()
  725. {
  726.   int ch;
  727.  
  728.   app_begin ();
  729.   while ((ch = do_scrub_next_char (stdin)) != EOF)
  730.     putc (ch, stdout);
  731. }
  732.  
  733. as_warn (str)
  734.      char *str;
  735. {
  736.   fputs (str, stderr);
  737.   putc ('\n', stderr);
  738. }
  739.  
  740. #endif
  741.  
  742. /* end of app.c */
  743.